home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / os20 / cdity / huntwin6.lha / huntwindows.s < prev   
Text File  |  1993-04-05  |  40KB  |  1,901 lines

  1.              output    work:huntwindows
  2.             OPT o+,ow-
  3.             ;no includes - i use them all preassembled!
  4.  
  5.             ;.... nearly all ....
  6.  
  7.             incdir    "sys:devpac/include/"
  8.             include "workbench/startup.i"
  9.             include "workbench/workbench.i"
  10.             include    "workbench/icon_lib.i"
  11.             include    "libraries/commodities.i"
  12.  
  13. ;TODO:
  14. ;Hotkey for GUI
  15.  
  16. ;BUGS:
  17. ;SOMETIMES... there is a guru at closedown
  18.     
  19.             ;Some helpful macros
  20. CALL            macro
  21.             jsr    _LVO\1(a6)
  22.             endm
  23. Push            macro
  24.             movem.l    \1,-(sp)
  25.             endm
  26. Pull            macro
  27.             movem.l    (sp)+,\1
  28.             endm
  29. RSave            macro
  30.             movem.l    a0-a6/d0-d7,-(sp)
  31.             endm
  32. RLoad            macro
  33.             movem.l    (sp)+,a0-a6/d0-d7
  34.             endm
  35.  
  36. MaxScreens        equ    64    ;Maximum of 64 Screens - who has more?
  37. ScreenMemSize        equ    MaxScreens*8    
  38.  
  39.         ;Bits for Communication
  40. SignalWindow        equ    0
  41. SignalScreen        equ    1
  42.  
  43.             RSave
  44.  
  45.             move.l    $04,a6
  46.             move.l    #AllocLength,d0
  47.             move.l    #MEMF_CLEAR,d1
  48.             CALL    AllocMem
  49.             move.l    d0,a4
  50.             tst.l    d0
  51.             beq    EndeRaus
  52.  
  53.             move.l    d0,RememberA4
  54.             move.l    a7,RememberStack
  55.  
  56.             lea    intuition(pc),a1
  57.             moveq.l    #36,d0
  58.             CALL    OpenLibrary
  59.             move.l    d0,IntBase(a4)
  60.             beq    EndeRaus2
  61.  
  62.             lea    DosName(pc),a1
  63.             moveq.l    #36,d0
  64.             CALL    OpenLibrary    
  65.             move.l    d0,DosBase(a4)
  66.             beq    Error2
  67.  
  68.             lea    GadName(pc),a1
  69.             moveq.l    #0,d0
  70.             CALL    OpenLibrary
  71.             move.l    d0,GadBase(a4)
  72.             beq    Error2
  73.  
  74.             lea    CommName(pc),a1
  75.             moveq.l    #0,d0
  76.             CALL    OpenLibrary
  77.             move.l    d0,CommBase(a4)
  78.             beq    Error2
  79.  
  80.             CALL    CreateMsgPort
  81.             move.l    d0,MouseMsgPort(a4)
  82.             beq    Error2
  83.  
  84.             move.l    #SIGBREAKF_CTRL_C,SignalMask(a4)
  85.  
  86.             move.l    d0,a0
  87.             move.l    #IOSTD_SIZE,d0
  88.             CALL    CreateIORequest
  89.             move.l    d0,MyIORequest(a4)
  90.             beq    Error2
  91.  
  92.             lea    InputName(pc),a0
  93.             moveq.l    #0,d0
  94.             move.l    MyIORequest(a4),a1
  95.             moveq.l    #0,d1
  96.             CALL    OpenDevice
  97.             tst.l    d0
  98.             bne    Error2
  99.  
  100.             lea    IconName(pc),a1
  101.             moveq.l    #33,d0
  102.             CALL    OpenLibrary
  103.             move.l    d0,IconBase(a4)
  104.             beq    Error2
  105.  
  106.             move.l    ThisTask(a6),a1
  107.             move.l    a1,OwnTask(a4)
  108.             tst.l    pr_CLI(a1)
  109.             bne    CliStart
  110.             lea    pr_MsgPort(a1),a2
  111.             move.l    a2,a0
  112.             CALL    WaitPort
  113.             move.l    a2,a0
  114.             CALL    GetMsg
  115.             move.l    d0,WBMessage(a4)
  116.             move.l    d0,a3
  117.         
  118.             move.l    sm_ArgList(a3),d7
  119.             beq    DisableSave
  120.             move.l    d7,a0
  121.             move.l    wa_Lock(a0),d1
  122.             move.l    DosBase(a4),a6
  123.             CALL    CurrentDir
  124.  
  125.             move.l    IconBase(a4),a6
  126.             move.l    d7,a0
  127.             move.l    wa_Name(a0),a0
  128.             CALL    GetDiskObject
  129.             move.l    d0,DObject(a4)
  130.             beq    Error2
  131.  
  132.             lea    WBTemplate(pc),a3
  133.  
  134.             move.l    d0,a0
  135.             move.l    do_ToolTypes(a0),a0
  136.             
  137. GetEmLoop        tst.l    (a3)
  138.             beq.s    FreeDobj
  139.             move.l    TemplateText(a3),a1
  140.             beq.s    FreeDobj
  141.             move.l    a0,-(sp)
  142.             CALL    FindToolType
  143.             move.l    (sp)+,a0
  144.             sub.l    a2,a2
  145.             move.w    TemplateA4(a3),a2
  146.             add.l    a4,a2
  147.             move.l    d0,(a2)
  148.             add.l    #TemplateSize,a3
  149.             bra.s    GetEmLoop
  150.  
  151. FreeDobj        bsr    BuildPatterns
  152.  
  153.             bra.s    SkipReadArgs
  154.  
  155. CliStart        move.l    DosBase(a4),a6
  156.  
  157.             move.l    #Template,d1
  158.             lea    TemplateArray(a4),a0
  159.             move.l    a0,d2
  160.             moveq.l    #0,d3
  161.             CALL    ReadArgs    ;Get options
  162.             tst.l    d0
  163.             beq    Error2
  164.             move.l    d0,Args(a4)
  165.     
  166.             bsr    BuildPatterns
  167.  
  168. DisableSave        move.l    #1,TempSave(a4)
  169.  
  170. SkipReadArgs        move.l    $04,a6
  171.             lea    GraphicsName(pc),a1
  172.             moveq.l    #36,d0
  173.             CALL    OpenLibrary
  174.             move.l    d0,GraphicsBase(a4)
  175.             beq    Error2
  176.  
  177.             tst.l    TempHADJ(a4)
  178.             beq    GotIt1
  179.             move.l    TempHADJ(a4),a0
  180.             bsr    GetNexta0
  181.             clr.l    TempHADJ(a4)
  182.             cmp.b    #"l",d0
  183.             beq.s    GotIt1
  184.             add.l    #1,TempHADJ(a4)
  185.             cmp.b    #"r",d0
  186.             beq.s    GotIt1
  187.             add.l    #1,TempHADJ(a4)
  188.             cmp.b    #"c",d0
  189.             beq.s    GotIt1
  190.             add.l    #1,TempHADJ(a4)
  191.  
  192. GotIt1            tst.l    TempVADJ(a4)
  193.             beq    GotIt2
  194.             move.l    TempVADJ(a4),a0
  195.             bsr    GetNexta0
  196.             clr.l    TempVADJ(a4)
  197.             cmp.b    #"t",d0
  198.             beq.s    GotIt2
  199.             add.l    #1,TempVADJ(a4)
  200.             cmp.b    #"b",d0
  201.             beq.s    GotIt2
  202.             add.l    #1,TempVADJ(a4)
  203.             cmp.b    #"c",d0
  204.             beq.s    GotIt2
  205.             add.l    #1,TempVADJ(a4)
  206.  
  207. GotIt2            tst.l    TempCXPRI(a4)
  208.             beq.s    GotIt3
  209.             move.l    TempCXPRI(a4),a0
  210.             bsr    GetNexta0
  211.             bsr    GetInteger
  212.             move.l    d0,TempCXPRI(a4)
  213.             move.b    d0,MyPri
  214.  
  215. GotIt3            move.l    $04,a6
  216.             CALL    CreateMsgPort
  217.             move.l    d0,BrokerPort
  218.             move.l    d0,MyPort(a4)
  219.             move.l    d0,a0
  220.             move.b    MP_SIGBIT(a0),d0
  221.             move.l    SignalMask(a4),d1        ;Enter signal into
  222.             bset    d0,d1            ;mask for waiting
  223.             move.l    d1,SignalMask(a4)
  224.  
  225.             move.l    CommBase(a4),a6
  226.             lea    MyNewBroker(pc),a0
  227.             clr.l    d0
  228.             CALL    CxBroker
  229.             tst.l    d0
  230.             beq    QuitPrg
  231.             move.l    d0,Broker(a4)
  232.  
  233.             move.l    d0,a0
  234.             moveq.l    #1,d0
  235.             CALL    ActivateCxObj
  236.  
  237.             bsr    InstallHotKey
  238.  
  239.             move.l    $04,a6
  240.                     moveq   #-1,d0            ;A Signal for telling
  241.                     jsr     _LVOAllocSignal(a6)    ;our task that sth happened
  242.                     tst.l   d0
  243.                     bmi     Error2
  244.                     move.l  d0,Signal(a4)
  245.             move.l    SignalMask(a4),d1
  246.                     bset    d0,d1
  247.                     move.l    d1,SignalMask(a4)
  248.  
  249.             lea    MyInterrupt(a4),a1
  250.             move.l    #Interrupt3,IS_CODE(a1)
  251.             clr.l    IS_DATA(a1)
  252.             move.b    #NT_INTERRUPT,LN_TYPE(a1)
  253.             move.b    #0,LN_PRI(a1)
  254.             move.l    #HandlerName,LN_NAME(a1)
  255.             move.l    #5,d0    ;INTB_VERTB
  256.             jsr    _LVOAddIntServer(a6)
  257.  
  258.             tst.l    TempCXPOPUP(a4)
  259.             beq.s    WaitOn
  260.             bsr    OpenGUI
  261.  
  262. WaitOn            tst.w    QuitMe(a4)
  263.             bne    QuitPrg
  264.  
  265.             move.l    $04,a6
  266.             move.l    SignalMask(a4),d0        ;Wait for Port and Break
  267.             CALL    Wait
  268.             btst    #SIGBREAKB_CTRL_C,d0    ;This means quit
  269.             bne    QuitPrg
  270.             move.l    Signal(a4),d1
  271.             btst    d1,d0            ;Signal from Interrupt?
  272.             beq.s    TryNextMsg
  273.  
  274.             tst.w    DisableHW(a4)
  275.             bne.s    TryNextMsg        ;Do nothing
  276.  
  277.             move.l    IntBase(a4),a0
  278.             btst    #SignalWindow,What(a4)
  279.             beq.s    NoWindowStuff
  280.             
  281.             move.l    ib_ActiveWindow(a0),a0
  282.             bsr    DoYourJob
  283.             bclr    #SignalWindow,What(a4)
  284.  
  285. NoWindowStuff        btst    #SignalScreen,What(a4)
  286.             beq.s    TryNextMsg
  287.             move.l    IntBase(a4),a0
  288.             move.l    ib_FirstScreen(a0),a0
  289.             bsr    AdjustScreen
  290.             bclr    #SignalScreen,What(a4)
  291.  
  292. TryNextMsg        move.l    MyPort(a4),a0        ;Get the message awaiting
  293.             CALL    GetMsg
  294.             tst.l    d0
  295.             bne.s    GotMsg
  296.             bsr    CheckGUI
  297.             bra    WaitOn
  298.  
  299. GotMsg            move.l    d0,a3
  300.             move.l    d0,a0
  301.             move.l    CommBase(a4),a6
  302.             CALL    CxMsgType
  303.             move.l    d0,d6
  304.             move.l    a3,a0
  305.             CALL    CxMsgID
  306.             move.l    d0,d5
  307.             move.l    a3,a1
  308.             move.l    $04,a6
  309.             CALL    ReplyMsg
  310.             cmp.w    #CXM_IEVENT,d6
  311.             bne.s    OtherCommand
  312.             bsr    OpenGUI
  313.  
  314. OtherCommand        cmp.w    #CXM_COMMAND,d6
  315.             bne    WaitOn
  316.  
  317.             cmp.w    #CXCMD_DISABLE,d5
  318.             bne.s    OtherI1
  319.             move.w    #1,DisableHW(a4)
  320.  
  321. OtherI1            cmp.w    #CXCMD_ENABLE,d5
  322.             bne.s    OtherI2
  323.             clr.w    DisableHW(a4)
  324.  
  325. OtherI2            cmp.w    #CXCMD_UNIQUE,d5
  326.             beq.s    OtherII
  327.             cmp.w    #CXCMD_APPEAR,d5
  328.             bne.s    OtherI3
  329. OtherII            bsr    OpenGUI
  330.  
  331. OtherI3            cmp.w    #CXCMD_DISAPPEAR,d5
  332.             bne.s    OtherI4
  333.             bsr    CloseGUI
  334.  
  335. OtherI4            cmp.w    #CXCMD_KILL,d5
  336.             beq    QuitPrg
  337.  
  338.             bra    TryNextMsg
  339.  
  340. Error2            lea    Text1(pc),a0        ;Seems there is an error
  341.             bsr    OpenRequester        ;in the given arguments
  342.             bra.s    QuitPrg
  343.  
  344. EndeRaus2        lea    Text2(pc),a0        ;Wrong Kickstart
  345.             bsr    PrintText
  346.  
  347. QuitPrg            move.l    RememberStack,a7
  348.             bsr    CloseGUI
  349.             move.l    $04,a6    
  350.             move.l    #5,d0
  351.             lea    MyInterrupt(a4),a1
  352.             tst.l    IS_CODE(a1)
  353.             beq.s    NoHandler
  354.             CALL    RemIntServer        ;Remove the Interrupt-Server
  355.  
  356. NoHandler        tst.l    MyIORequest(a4)
  357.             beq.s    NoDevIO
  358.             move.l    MyIORequest(a4),a1
  359.             CALL    CloseDevice
  360.             move.l    MyIORequest(a4),a0
  361.             CALL    DeleteIORequest    
  362. NoDevIO            tst.l    MouseMsgPort(a4)
  363.             beq.s    NoMouseMsg
  364.  
  365.             move.l    MouseMsgPort(a4),a0
  366.             bsr    CloseMsgPort
  367.  
  368. NoMouseMsg        move.l    IconBase(a4),a6
  369.             tst.l    DObject(a4)
  370.             beq.s    SkipFreeDobj
  371.             move.l    DObject(a4),a0
  372.             CALL    FreeDiskObject
  373.  
  374. SkipFreeDobj        move.l    $04,a6
  375.             move.l    Signal(a4),d0        ;Free the signal
  376.             beq.s    DontFreeS
  377.                     CALL    FreeSignal
  378.  
  379. DontFreeS        tst.l    Args(a4)
  380.             beq.s    HmmNoArgs
  381.             move.l    DosBase(a4),a6
  382.             move.l    Args(a4),d1
  383.             CALL    FreeArgs
  384.  
  385. HmmNoArgs        bsr    RemovePopKey
  386.  
  387.             tst.l    Broker(a4)
  388.             beq.s    NoCX
  389.             move.l    CommBase(a4),a6
  390.             move.l    Broker(a4),a0
  391.             CALL    DeleteCxObjAll
  392.  
  393. NoCX            move.l    $04,a6
  394.             tst.l    MyPort(a4)
  395.             beq.s    NoPort
  396.             move.l    MyPort(a4),a0
  397.             bsr    CloseMsgPort
  398.  
  399. NoPort            move.l    IntBase(a4),d0        ;Close librarys
  400.             beq.s    ErrorX2
  401.             move.l    d0,a1
  402.             CALL    CloseLibrary
  403.  
  404. ErrorX2            move.l    GraphicsBase(a4),d0
  405.             beq.s    ErrorX1
  406.             move.l    d0,a1
  407.             CALL    CloseLibrary
  408.  
  409. ErrorX1            move.l    IconBase(a4),d0
  410.             beq.s    NoIconLib
  411.             move.l    d0,a1
  412.             CALL    CloseLibrary
  413.             
  414. NoIconLib        move.l    CommBase(a4),d0
  415.             beq.s    NoCommLib
  416.             move.l    d0,a1
  417.             CALL    CloseLibrary
  418.  
  419. NoCommLib        move.l    GadBase(a4),d0
  420.             beq.s    OnlyDOS
  421.             move.l    d0,a1
  422.             CALL    CloseLibrary
  423.  
  424. OnlyDOS            move.l    DosBase(a4),d0
  425.             beq.s    FreeOnly
  426.             move.l    d0,a1
  427.             CALL    CloseLibrary
  428.  
  429. FreeOnly        move.l    ScreenPatLen(a4),d0
  430.             beq.s    NoScreenPat
  431.             move.l    ScreenPattern(a4),a1
  432.             CALL    FreeMem
  433.  
  434. NoScreenPat        move.l    WindowPatLen(a4),d0
  435.             beq.s    NoWindowPat
  436.             move.l    WindowPattern(a4),a1
  437.             CALL    FreeMem
  438.  
  439. NoWindowPat        move.l    WBMessage(a4),d7
  440.             move.l    a4,a1
  441.             move.l    #AllocLength,d0
  442.             CALL    FreeMem            
  443.  
  444.             move.l    d7,a1
  445.             tst.l    d7
  446.             beq.s    EndeRaus
  447.             CALL    Forbid
  448.             CALL    ReplyMsg
  449.  
  450. EndeRaus        RLoad
  451.             moveq.l    #0,d0
  452.             rts
  453.  
  454. CloseMsgPort        move.l    a0,a3
  455. ClosePortRout        move.l    a3,a0
  456.             CALL    GetMsg
  457.             tst.l    d0
  458.             beq.s    NoMsgLeft
  459.             move.l    d0,a1
  460.             CALL    ReplyMsg
  461.             bra.s    ClosePortRout
  462. NoMsgLeft        move.l    a3,a0
  463.             CALL    DeleteMsgPort        ;and free it
  464.             rts
  465.  
  466.  
  467.             ;Subroutine to print a text to stdout
  468. PrintText        Push    d0-d4/a0-a1/a6
  469.             move.l    a0,a1
  470.             moveq.l    #0,d0
  471. TestLen            tst.b    (a1)+
  472.             beq.s    LaengeOk
  473.             addq    #1,d0
  474.             bra.s    TestLen
  475. LaengeOk        move.l    $04,a6
  476.             lea    DosName(pc),a1
  477.             moveq.l    #0,d0
  478.             CALL    OpenLibrary    
  479.             move.l    d0,DosBase(a4)
  480.             beq    SkipWrite
  481.             move.l    d0,a6
  482.             move.l    a0,d2
  483.             move.l    d0,d3
  484.             CALL    Output
  485.             move.l    d0,d1
  486.             beq.s    SkipWrite
  487.             CALL    Write
  488. SkipWrite        Pull    d0-d4/a0-a1/a6
  489.             rts
  490.  
  491.             ;MainPart: does the scrolling if necessary
  492.             ;Gets window in a0
  493. DoYourJob        RSave
  494.             move.l    a0,d0        ;No Window - let it be!
  495.             beq    LeaveIt
  496.             move.l    a0,a5
  497.  
  498.             move.l    wd_WScreen(a5),a3
  499.             
  500.             move.l    DosBase(a4),a6
  501.  
  502.             tst.b    ScreenPatternMem(a4)
  503.             beq.s    NoMatter2
  504.             move.l    ScreenPattern(a4),d1
  505.             move.l    sc_DefaultTitle(a3),d2
  506.             CALL    MatchPatternNoCase
  507.             beq    LeaveIt
  508.  
  509. NoMatter2        tst.b    WindowPatternMem(a4)
  510.             beq.s    NoMatter3
  511.             move.l    WindowPattern(a4),d1
  512.             move.l    wd_Title(a5),d2
  513.             CALL    MatchPatternNoCase
  514.             beq    LeaveIt
  515.  
  516. NoMatter3        move.l    a3,a0
  517.             move.l    a5,d0
  518.             bsr    RememberWindow
  519. NoInterest        move.l    a0,d0        ;Screen not valid? - let it be!
  520.             beq    LeaveIt
  521.  
  522. NoMatter        move.l    GraphicsBase(a4),a6        ;Get the visible size
  523.             lea    sc_ViewPort(a3),a0    ;of the screen to
  524.             CALL    GetVPModeID        ;determine when a window
  525.             move.l    d0,d2            ;is visible and when not
  526.             lea    DisplayInfer(a4),a1
  527.             move.l    #dim_SIZEOF,d0
  528.             move.l    #DTAG_DIMS,d1
  529.             sub.l    a0,a0
  530.             CALL    GetDisplayInfoData
  531.             lea    DisplayInfer(a4),a0
  532.             lea    dim_TxtOScan(a0),a0
  533.             move.w    ra_MaxX(a0),d0
  534.             sub.w    ra_MinX(a0),d0
  535.             addq    #1,d0
  536.             move.w    d0,VisualX(a4)
  537.  
  538.             move.w    ra_MaxY(a0),d0
  539.             sub.w    ra_MinY(a0),d0
  540.             addq    #1,d0
  541.             move.w    d0,VisualY(a4)
  542.  
  543.             move.l    a3,a0
  544.             move.l    IntBase(a4),a6
  545.             tst.l    TempSFront(a4)        ;do we want screentofront?
  546.             beq.s    NoFront
  547.             CALL    ScreenToFront
  548.             bset    #SignalScreen,What(a4)    ;ScreenChange!
  549.  
  550. NoFront            move.l    wd_Flags(a5),d0
  551.             and.l    #WFLG_BACKDROP,d0
  552.             bne    LeaveIt        ;Not with backdrops!
  553.  
  554.             tst.l    TempWFront(a4)        ;do we WindowToFront() ?
  555.             beq.s    NoFront2
  556.             move.l    a5,a0
  557.             move.l    wd_Flags(a0),d0
  558.             and.l    #WBENCHWINDOW,d0    ;does not work - but why?
  559.             bne.s    NoFront2
  560.             CALL    WindowToFront
  561.  
  562. NoFront2        tst.l    TempMove(a4)
  563.             beq    LeaveIt
  564.             move.l    wd_WScreen(a5),a0    ;If the screen is smaller
  565.             move.w    sc_Width(a0),d0        ;that the visible size
  566.             cmp.w    VisualX(a4),d0        ;in any way, we use the
  567.             bcc.s    NoMat1            ;original screen-size
  568.             move.w    sc_Width(a0),VisualX(a4)
  569. NoMat1            move.w    sc_Height(a0),d0
  570.             cmp.w    VisualY(a4),d0
  571.             bcc.s    NoMat2
  572.             move.w    sc_Height(a0),VisualX(a4)
  573.             
  574.  
  575. NoMat2            moveq.l    #0,d7
  576.             moveq.l    #0,d6
  577.             moveq.l    #0,d0
  578.             moveq.l    #0,d2
  579.             move.w    wd_LeftEdge(a5),d0
  580.             add.w    wd_Width(a5),d0
  581.             move.w    sc_LeftEdge(a0),d2
  582.             neg.w    d2
  583.             add.w    VisualX(a4),d2
  584.             sub.w    d0,d2
  585.             beq.s    SeemsOk2
  586.             bpl.s    SeemsOk
  587.             move.w    d2,d7        ;MOVEX!
  588.             ext.l    d7
  589. SeemsOk            move.w    wd_LeftEdge(a5),d0
  590.             move.w    sc_LeftEdge(a0),d2
  591.             neg.w    d2
  592.             sub.w    d2,d0
  593.             bne.s    TestAgain
  594.             moveq.l    #0,d7
  595. TestAgain        bpl.s    SeemsOk2
  596.             move.w    d0,d7        ;MOVEX!    - Prefer Leftedge
  597.             ext.l    d7
  598.             neg.l    d7
  599. SeemsOk2        move.w    wd_TopEdge(a5),d0
  600.             move.w    sc_TopEdge(a0),d2
  601.             neg.w    d2
  602.             sub.w    d2,d0
  603.             beq.s    SeemsOk4
  604.             bpl.s    SeemsOk3
  605.             move.w    d0,d6
  606.             ext.l    d6        ;MOVEY!
  607.             neg.l    d6
  608. SeemsOk3        move.w    wd_TopEdge(a5),d0
  609.             add.w    wd_Height(a5),d0
  610.             move.w    sc_TopEdge(a0),d2
  611.             neg.w    d2
  612.             add.w    VisualY(a4),d2
  613.             sub.w    d0,d2
  614.             bne.s    TestAgain2
  615.             moveq.l    #0,d6
  616. TestAgain2        bpl.s    SeemsOk4
  617.             move.w    d2,d6        ;MOVEY! - Prefer bottom
  618.             ext.l    d6
  619. SeemsOk4        tst.l    TempAlways(a4)
  620.             bne.s    DOOO
  621.             tst.l    d7
  622.             bne.s    DOOO
  623.             tst.l    d6
  624.             beq    LeaveIt
  625.  
  626. DOOO            move.l    d7,d0
  627.             tst.l    TempAlways(a4)
  628.             bne.s    DoAlways1
  629.             tst.l    d0
  630.             beq.s    NoMoveAny1
  631. DoAlways1        cmp.l    #2,TempHADJ(a4)
  632.             bne.s    NoCentering1
  633.  
  634.             moveq.l    #0,d0
  635.             move.w    wd_Width(a5),d0
  636.             lsr.w    #1,d0
  637.             add.w    wd_LeftEdge(a5),d0
  638.             moveq.l    #0,d2
  639.             move.w    VisualX(a4),d2
  640.             lsr.w    #1,d2
  641.             move.w    sc_LeftEdge(a0),d3
  642.             neg.w    d3
  643.             add.w    d3,d2
  644.             sub.w    d0,d2
  645.             move.l    d2,d0
  646.             ext.l    d0
  647.             bra    NoMoveAny1
  648.             
  649. NoCentering1        tst.l    TempHADJ(a4)
  650.             bne.s    RightAdj
  651.             moveq.l    #0,d0
  652.             move.w    wd_LeftEdge(a5),d0
  653.             add.w    sc_LeftEdge(a0),d0
  654.             neg.w    d0
  655.             ext.l    d0
  656.             bra.s    NoMoveAny1
  657.  
  658. RightAdj        cmp.l    #1,TempHADJ(a4)
  659.             bne.s    NoMoveAny1
  660.             move.w    wd_LeftEdge(a5),d0
  661.             add.w    wd_Width(a5),d0
  662.             move.w    sc_LeftEdge(a0),d2
  663.             neg.w    d2
  664.             add.w    VisualX(a4),d2
  665.             sub.w    d0,d2
  666.             move.l    d2,d0
  667.             ext.l    d0
  668.  
  669. NoMoveAny1        move.l    d6,d1
  670.             tst.l    TempAlways(a4)
  671.             bne.s    DoAlways2
  672.             tst.l    d1
  673.             beq.s    NoMoveAny2
  674. DoAlways2        cmp.l    #2,TempVADJ(a4)
  675.             bne.s    NoCentering2
  676.  
  677.             moveq.l    #0,d1
  678.             move.w    wd_Height(a5),d1
  679.             lsr.w    #1,d1
  680.             add.w    wd_TopEdge(a5),d1
  681.             moveq.l    #0,d2
  682.             move.w    VisualY(a4),d2
  683.             lsr.w    #1,d2
  684.             move.w    sc_TopEdge(a0),d3
  685.             neg.w    d3
  686.             add.w    d3,d2
  687.             sub.w    d1,d2
  688.             move.l    d2,d1
  689.             ext.l    d1
  690.             bra    NoMoveAny2
  691.  
  692. NoCentering2        tst.l    TempVADJ(a4)
  693.             bne.s    BotAdj
  694.             moveq.l    #0,d1
  695.             move.w    wd_TopEdge(a5),d1
  696.             add.w    sc_TopEdge(a0),d1
  697.             neg.w    d1
  698.             ext.l    d1
  699.             bra.s    NoMoveAny2
  700.  
  701. BotAdj            cmp.l    #1,TempVADJ(a4)
  702.             bne.s    NoMoveAny2
  703.             move.w    wd_TopEdge(a5),d1
  704.             add.w    wd_Height(a5),d1
  705.             move.w    sc_TopEdge(a0),d2
  706.             neg.w    d2
  707.             add.w    VisualY(a4),d2
  708.             sub.w    d1,d2
  709.             move.l    d2,d1
  710.             ext.l    d1
  711.  
  712. NoMoveAny2        move.w    sc_TopEdge(a0),d5
  713.             move.w    sc_LeftEdge(a0),d6
  714.             RSave
  715.             CALL    MoveScreen
  716.             RLoad
  717.             sub.w    sc_TopEdge(a0),d5    ;Find out how far the
  718.             sub.w    sc_LeftEdge(a0),d6    ;screen really moves
  719.             move.l    d6,d0
  720.             move.l    d5,d1
  721.             neg.l    d0
  722.             neg.l    d1
  723.  
  724.             tst.l    TempMoveMouse(a4)
  725.             beq.s    LeaveIt
  726.  
  727.             ;If a window becomes active without clicking, the Mouse
  728.             ;can be out of range, and moving it would scroll the
  729.             ;Screen back, so we check this here and disable movement
  730.             ;if "dangerous"
  731.             move.w    ib_MouseX(a6),d2
  732.             add.w    d0,d2    ;Movement in X
  733.             bmi.s    ClearXMovement
  734.             cmp.w    VisualX(a4),d2
  735.             bcs.s    LeaveXMovement
  736. ClearXMovement        moveq.l    #0,d0
  737. LeaveXMovement        move.w    ib_MouseY(a6),d2
  738.             add.w    d1,d2    ;Movement in Y
  739.             bmi.s    ClearYMovement
  740.             cmp.w    VisualY(a4),d2
  741.             bcs.s    LeaveYMoveMent
  742. ClearYMovement        moveq.l    #0,d1
  743. LeaveYMoveMent        bsr    SetPointer
  744. LeaveIt            RLoad
  745.             rts
  746.  
  747.             ;ScreenID in a0
  748. AdjustScreen        RSave
  749.             move.l    a0,a3
  750.             tst.b    ScreenPatternMem(a4)
  751.             beq.s    NoMatter5
  752.             move.l    ScreenPattern(a4),d1
  753.             move.l    sc_DefaultTitle(a3),d2
  754.             move.l    DosBase(a4),a6
  755.             CALL    MatchPatternNoCase
  756.             beq    SkipActive
  757.             move.l    a3,a0
  758.  
  759. NoMatter5        tst.l    TempPDef(a4)    ;Enter FirstScreen as Default
  760.                         ;PublicScreen ?
  761.             beq.s    Skip_NoPub
  762.             bsr    GetPubFromID
  763.             move.l    a0,d0
  764.             beq.s    Skip_NoPub
  765.             move.l    IntBase(a4),a6
  766.             CALL    SetDefaultPubScreen
  767.  
  768. Skip_NoPub        move.l    a3,a0
  769.             tst.l    TempRemWin(a4)    ;Activate a Window on the new
  770.                         ;Screen?
  771.             beq.s    SkipActive
  772.             bsr    GetScreenWindow
  773.             tst.l    d0
  774.             bne.s    FoundActive
  775.  
  776.             move.l    sc_FirstWindow(a0),d0    ;Take Firstwindow if none
  777.             beq.s    SkipActive        ;known
  778.  
  779. FoundActive        move.l    d0,a5
  780.             tst.b    WindowPatternMem(a4)
  781.             beq.s    NoMatter4
  782.             move.l    WindowPattern(a4),d1
  783.             move.l    wd_Title(a5),d2
  784.             move.l    DosBase(a4),a6
  785.             CALL    MatchPatternNoCase
  786.             beq    SkipActive
  787. NoMatter4        move.l    a5,a0
  788.             move.l    IntBase(a4),a6
  789.             CALL    ActivateWindow
  790. SkipActive        RLoad
  791.             rts
  792.  
  793.         ;a0=Screen         Back:d0=Window
  794. GetScreenWindow        Push    a1/d1
  795.             lea    ScreenMem(a4),a1
  796.             move.w    #MaxScreens-1,d1
  797. ScreenFindLoop        cmp.l    (a1),a0
  798.             beq.s    FoundScreen
  799.             lea    8(a1),a1
  800.             dbf    d1,ScreenFindLoop
  801. FoundScreen        move.l    4(a1),d0
  802.             bsr    TestWindowOnScreen
  803.             Pull    a1/d1
  804.             rts
  805.  
  806.         ;a0=Screen d0=Window
  807. RememberWindow        Push    a1-a3/a6/d1
  808.             move.l    IntBase(a4),a6
  809.             lea    ScreenMem(a4),a1
  810.             move.w    #MaxScreens-1,d1
  811. ScreenFindLoop2        tst.l    (a1)
  812.             beq.s    FoundEmpty
  813.             move.l    (a1),a2
  814.             cmp.l    a0,a2
  815.             beq.s    FoundEmpty    ;because Identical
  816.  
  817.             move.l    ib_FirstScreen(a6),a3
  818. CheckAllScreens        cmp.l    a3,a2
  819.             beq    ScreenValid
  820.             move.l    sc_NextScreen(a3),a3
  821.             cmp.l    #0,a3
  822.             bne.s    CheckAllScreens
  823.             bra.s    FoundEmpty    ;because Entry is invalid
  824.  
  825. ScreenValid        lea    8(a1),a1
  826.             dbf    d1,ScreenFindLoop2
  827.             ;Reaching this Point our List is full of valid
  828.             ;Screens - not the best thing, but we simply ignore...
  829.             bra.s    IgnoreOver
  830. FoundEmpty        move.l    a0,(a1)
  831.             move.l    d0,4(a1)
  832. IgnoreOver        Pull    a1-a3/a6/d1
  833.             rts
  834.  
  835.         ;d0=Window , a0=Screen    =Back: d0=0 no window
  836. TestWindowOnScreen    tst.l    d0
  837.             beq.s    NotWindow
  838.             move.l    sc_FirstWindow(a0),a1
  839. WindowListOn        cmp.l    d0,a1
  840.             beq.s    WindowIsOK
  841.             move.l    wd_NextWindow(a1),a1
  842.             cmp.l    #0,a1
  843.             bne.s    WindowListOn
  844. NotWindow        clr.l    d0
  845.             rts
  846. WindowIsOK        move.l    a1,d0
  847.             rts
  848.  
  849.             ;ScreenID in a0    ;Return a0=PubScreenName or Zero
  850. GetPubFromID        Push    d0/a3/a6
  851.             move.l    a0,a3
  852.             move.l    IntBase(a4),a6
  853.             CALL    LockPubScreenList
  854.  
  855. CarryListOn        move.l    d0,a0
  856.             cmp.l    psn_Screen(a0),a3
  857.             beq.s    ScreenFound
  858.             move.l    LN_SUCC(a0),d0
  859.             bne.s    CarryListOn
  860.             sub.l    a0,a0
  861.             bra.s    ENDPS
  862.  
  863. ScreenFound        move.l    LN_NAME(a0),a0
  864. ENDPS            move.l    a0,-(sp)
  865.             CALL    UnlockPubScreenList
  866.             move.l    (sp)+,a0
  867.             Pull    d0/a3/a6
  868.             rts
  869.  
  870. Interrupt3        Push    d1-d4/a0-a1/a3/a4/a6
  871.             move.l    RememberA4,a4
  872.             move.l    IntBase(a4),a3
  873.             move.l    Active(a4),d0
  874.             cmp.l    ib_ActiveWindow(a3),d0        ;New ActiveWindow?
  875.             beq.s    DoScreen
  876.             move.l    ib_ActiveWindow(a3),Active(a4)
  877.  
  878.             bsr    SignalMyself
  879.  
  880.             bset    #SignalWindow,What(a4)
  881.             
  882. DoScreen        move.l    FirstSc(a4),d0
  883.             cmp.l    ib_FirstScreen(a3),d0        ;New FirstScreen?
  884.             beq.s    DoNothing
  885.             move.l    ib_FirstScreen(a3),FirstSc(a4)
  886.  
  887.             bsr    SignalMyself
  888.  
  889.             bset    #SignalScreen,What(a4)
  890.  
  891. DoNothing        Pull    d1-d4/a0-a1/a3/a4/a6
  892.             moveq.l    #0,d0
  893.             rts
  894.  
  895. SignalMyself        move.l  $04,a6
  896.             move.l  OwnTask(a4),a1
  897.             move.l  Signal(a4),d1        ;send a signal to move Screen
  898.             moveq.l    #0,d0
  899.             bset    d1,d0
  900.             jmp    _LVOSignal(a6)
  901.  
  902. OpenGUI            RSave
  903.             tst.w    GUIOpened(a4)
  904.             bne    OpenNoGUI
  905.             move.l    IntBase(a4),a6
  906.             sub.l    a0,a0
  907.             CALL    LockPubScreen
  908.             move.l    d0,PublicScreen(a4)
  909.             move.l    d0,StorePublicScreen
  910.  
  911.             move.l    d0,a0
  912.             lea    sc_RastPort(a0),a1
  913.             move.l    a1,PublicRastport(a4)
  914.             lea    TagListDone(pc),a1
  915.             move.l    GadBase(a4),a6
  916.             CALL    GetVisualInfoA
  917.             move.l    d0,MyVisual(a4)
  918.             lea    MyNewGadget(a4),a3
  919.             move.l    d0,gng_VisualInfo(a3)
  920.  
  921.             lea    GadgetList(a4),a0
  922.             CALL    CreateContext
  923.             move.l    d0,Gadget0(a4)
  924.  
  925.             move.l    GraphicsBase(a4),a6
  926.             move.l    PublicRastport(a4),a1
  927.             lea    GUI_Text5(pc),a0
  928.             moveq.l    #GUI_Text6-GUI_Text5-1,d0
  929.             CALL    TextLength
  930.             add.w    #40,d0        ;CheckBox
  931.             lsr.w    #1,d0
  932.             move.w    d0,RemLen(a4)
  933.  
  934.             moveq.l    #1,d0
  935.             add.w    RemLen(a4),d0
  936.             lsl.l    #2,d0
  937.             move.l    d0,StoreInnerWidth
  938.  
  939.             move.l    PublicScreen(a4),a0
  940.             moveq.l    #6,d0
  941.             add.b    sc_WBorLeft(a0),d0
  942.             move.w    d0,RemLeft(a4)
  943.  
  944.             move.l    sc_Font(a0),a1
  945.             move.l    a1,gng_TextAttr(a3)
  946.             moveq.l    #1,d0
  947.             add.b    sc_WBorTop(a0),d0    ;Base (Top)
  948.             move.w    d0,RemTop(a4)
  949.  
  950.             move.w    ta_YSize(a1),d6
  951.             add.w    #4,d6            ;Height of One Line
  952.             move.w    d6,RemHeight(a4)
  953.  
  954.             add.w    #2,d6
  955.             mulu    #10,d6
  956.             add.w    #8,d6
  957.             move.l    d6,StoreInnerHeight
  958.  
  959.             move.l    Gadget0(a4),d7
  960.  
  961.             bsr    DoAllGadgets
  962.  
  963.             move.l    d7,LastGadget(a4)
  964.  
  965.             sub.l    a0,a0
  966.             lea    WindowTagList(pc),a1
  967.             move.l    IntBase(a4),a6
  968.             CALL    OpenWindowTagList
  969.             move.l    d0,MyWindow(a4)
  970.             beq    FailWindow
  971.  
  972.             move.l    d0,a0
  973.             bsr    EnterSignal
  974.             ;move.l    d0,a0
  975.             move.l    GadgetList(a4),a1
  976.             moveq.l    #-1,d0
  977.             moveq.l    #-1,d1
  978.             sub.l    a2,a2
  979.             CALL    AddGList
  980.  
  981.             move.l    GadgetList(a4),a0
  982.             move.l    MyWindow(a4),a1
  983.             moveq.l    #-1,d0
  984.             sub.l    a2,a2
  985.             CALL    RefreshGList
  986.             
  987.             move.l    GadBase(a4),a6
  988.             move.l    MyWindow(a4),a0
  989.             sub.l    a1,a1
  990.             CALL    GT_RefreshWindow
  991.  
  992.             move.w    #1,GUIOpened(a4)
  993.             RLoad
  994.             rts
  995. OpenNoGUI        move.l    IntBase(a4),a6
  996.             move.l    MyWindow(a4),a0
  997.             CALL    ActivateWindow
  998.             RLoad
  999.             rts
  1000.  
  1001.             rsreset
  1002. MyGadgetText        rs.l    1
  1003. MyGadgetList        rs.l    1
  1004. MyGadgetRowNr        rs.b    1
  1005. MyGadgetXPos        rs.b    1
  1006. MyGadgetWidth        rs.b    1
  1007. MyGadgetFlags        rs.b    1
  1008. MyGadgetStore        rs.w    1
  1009. MyGadgetKind        rs.w    1
  1010. MyGadgetSize        rs.w    1
  1011.             
  1012.             ;    gng_Flags      ,gng_Text ,CreateKind   ,CreateTags
  1013.             ;    gng_TopEdge    ,gng_LeftEdge
  1014. AllGadgets        dc.l    GUI_Text8,CycleTagList
  1015.             dc.b    1,2,2,PLACETEXT_LEFT
  1016.             dc.w    TempHADJ,CYCLE_KIND
  1017.             dc.l    GUI_Text9,CycleTagList2
  1018.             dc.b    2,2,2,PLACETEXT_LEFT
  1019.             dc.w    TempVADJ,CYCLE_KIND
  1020.             dc.l    GUI_Text16,StringTagList
  1021.             dc.b    5,2,2,PLACETEXT_LEFT
  1022.             dc.w    TempCXPOPKEY,STRING_KIND
  1023.             dc.l    GUI_Text12,StringTagList
  1024.             dc.b    3,2,2,PLACETEXT_LEFT
  1025.             dc.w    TempScreen,STRING_KIND
  1026.             dc.l    GUI_Text13,StringTagList
  1027.             dc.b    4,2,2,PLACETEXT_LEFT
  1028.             dc.w    TempWindow,STRING_KIND
  1029.  
  1030.             dc.l    GUI_Text1,GadgetTagList
  1031.             dc.b    6,0,2,PLACETEXT_RIGHT
  1032.             dc.w    TempMove,CHECKBOX_KIND
  1033.             dc.l    GUI_Text2,GadgetTagList
  1034.             dc.b    6,2,2,PLACETEXT_RIGHT
  1035.             dc.w    TempSFront,CHECKBOX_KIND
  1036.             dc.l    GUI_Text3,GadgetTagList
  1037.             dc.b    7,0,2,PLACETEXT_RIGHT
  1038.             dc.w    TempWFront,CHECKBOX_KIND
  1039.             dc.l    GUI_Text5,GadgetTagList
  1040.             dc.b    7,2,2,PLACETEXT_RIGHT
  1041.             dc.w    TempPDef,CHECKBOX_KIND
  1042.             dc.l    GUI_Text6,GadgetTagList
  1043.             dc.b    8,0,2,PLACETEXT_RIGHT
  1044.             dc.w    TempAlways,CHECKBOX_KIND
  1045.             dc.l    GUI_Text7,GadgetTagList
  1046.             dc.b    8,2,2,PLACETEXT_RIGHT
  1047.             dc.w    TempRemWin,CHECKBOX_KIND
  1048.             dc.l    GUI_Text7_1,GadgetTagList
  1049.             dc.b    9,0,2,PLACETEXT_RIGHT
  1050.             dc.w    TempMoveMouse,CHECKBOX_KIND
  1051.             dc.l    GUI_Text7_2,GadgetTagList
  1052.             dc.b    9,2,2,PLACETEXT_RIGHT
  1053.             dc.w    TempCXPOPUP,CHECKBOX_KIND
  1054.  
  1055.             dc.l    GUI_Text10,TagList
  1056.             dc.b    10,0,1,PLACETEXT_IN
  1057.             dc.w    TempZero,BUTTON_KIND
  1058.             dc.l    GUI_Text11,TagList
  1059.             dc.b    10,3,1,PLACETEXT_IN
  1060.             dc.w    TempZero,BUTTON_KIND
  1061. SaveGadgData        dc.l    GUI_Text14,TagList
  1062.             dc.b    10,1,1,PLACETEXT_IN
  1063.             dc.w    TempSave,BUTTON_KIND
  1064.             dc.l    GUI_Text15,TagList
  1065.             dc.b    10,2,1,PLACETEXT_IN
  1066.             dc.w    TempZero,BUTTON_KIND
  1067.  
  1068.             dc.l    -1
  1069.  
  1070.  
  1071.  
  1072. ;a3:Pointer to the GadgetStructure
  1073. ;d7:Previous Gadget
  1074.  
  1075. DoAllGadgets        lea    AllGadgets(pc),a5
  1076.             move.l    GadBase(a4),a6
  1077.             moveq.l    #1,d6
  1078.  
  1079. DoAllGadgets2        tst.l    (a5)
  1080.             bmi.s    WasLastGadget
  1081.  
  1082.             moveq.l    #0,d0
  1083.             move.b    MyGadgetRowNr(a5),d0
  1084.             move.w    RemHeight(a4),d1
  1085.             addq.w    #2,d1
  1086.             mulu    d1,d0
  1087.             add.w    RemTop(a4),d0    ;Top
  1088.             move.w    d0,gng_TopEdge(a3)
  1089.  
  1090.             moveq.l    #0,d0
  1091.             move.b    MyGadgetXPos(a5),d0
  1092.             mulu    RemLen(a4),d0
  1093.             add.w    RemLeft(a4),d0
  1094.             move.w    d0,gng_LeftEdge(a3)
  1095.  
  1096.             moveq.l    #0,d0
  1097.             move.b    MyGadgetWidth(a5),d0
  1098.             mulu    RemLen(a4),d0
  1099.             sub.w    #8,d0
  1100.             move.w    d0,gng_Width(a3)
  1101.  
  1102.             move.w    RemHeight(a4),gng_Height(a3)
  1103.  
  1104.             moveq.l    #0,d0
  1105.             move.b    MyGadgetFlags(a5),d0
  1106.             move.l    d0,gng_Flags(a3)
  1107.             add.w    #1,gng_GadgetID(a3)
  1108.  
  1109.             move.l    MyGadgetText(a5),gng_GadgetText(a3)
  1110.  
  1111.             move.w    d6,gng_GadgetID(a3)
  1112.  
  1113.             sub.l    a2,a2
  1114.             move.w    MyGadgetStore(a5),a2
  1115.             add.l    a4,a2
  1116.             move.l    (a2),d4
  1117.  
  1118.             moveq.l    #0,d0
  1119.             move.w    MyGadgetKind(a5),d0
  1120.             move.l    d7,a0        ;Previous Gadget
  1121.             move.l    a3,a1
  1122.             move.l    MyGadgetList(a5),a2
  1123.             move.l    d4,4(a2)
  1124.             CALL    CreateGadgetA
  1125.             move.l    d0,d7        ;Remember Previous Gadget
  1126.             add.l    #MyGadgetSize,a5
  1127.             addq.l    #1,d6
  1128.             bra.s    DoAllGadgets2
  1129. WasLastGadget        rts
  1130.  
  1131. CheckGUI        RSave
  1132.  
  1133.             tst.w    GUIOpened(a4)
  1134.             beq    NoGUI
  1135.  
  1136.             move.l    GadBase(a4),a6
  1137.             move.l    MyWindow(a4),a0
  1138.             move.l  wd_UserPort(a0),a0
  1139.             CALL    GT_GetIMsg
  1140.             tst.l   d0         
  1141.             beq     NoGUI
  1142.             move.l  d0,a1
  1143.             moveq.l    #0,d6
  1144.             move.w    im_Code(a1),d6    ;Value of Gadget
  1145.             move.l  im_IAddress(a1),a2
  1146.  
  1147.             move.l    im_Class(a1),d7
  1148.             CALL    GT_ReplyIMsg
  1149.  
  1150.             cmp.l    #GADGETUP,d7
  1151.             bne.s    Others
  1152.  
  1153.             move.w    gg_GadgetID(a2),d0
  1154.             move.l    gg_SpecialInfo(a2),a3
  1155.             cmp.w    #14,d0
  1156.             beq    HideGad
  1157.             cmp.w    #15,d0
  1158.             beq    QuitGad
  1159.             cmp.w    #16,d0
  1160.             beq    SaveGad
  1161.             cmp.w    #17,d0
  1162.             beq    AboutGad
  1163.  
  1164.             subq.l    #1,d0
  1165.  
  1166.             lea    AllGadgets(pc),a5
  1167.             mulu    #MyGadgetSize,d0
  1168.             sub.l    a2,a2
  1169.             move.w    MyGadgetStore(a5,d0.w),a2
  1170.             add.l    a4,a2
  1171.  
  1172.             cmp.w    #STRING_KIND,MyGadgetKind(a5,d0.w)
  1173.             bne.s    StandardGUI
  1174.             move.l    si_Buffer(a3),a0
  1175.             move.l    (a2),a1
  1176.             bsr    CopyPattern
  1177.             bsr    BuildPatterns
  1178.             bsr    InstallHotKey
  1179.             bra    NoGUI
  1180.  
  1181. StandardGUI        move.l    d6,(a2)
  1182.             bra    NoGUI
  1183.  
  1184. SaveGad            bsr    SaveConfig
  1185.             bra.s    NoGUI
  1186.  
  1187. AboutGad        lea    AboutText(pc),a0
  1188.             bsr    OpenRequester
  1189.             bra.s    NoGUI
  1190.  
  1191. QuitGad            bsr    CloseGUI
  1192.             move.w    #1,QuitMe(a4)
  1193.             bra.s    HideGad
  1194.  
  1195. Others                    cmp.l   #CLOSEWINDOW,d7
  1196.                     bne.s    NoClose
  1197. HideGad            bsr    CloseGUI
  1198.             bra.s    NoGUI
  1199. NoClose            cmp.l    #IDCMP_VANILLAKEY,d7
  1200.             bne.s    NoGUI
  1201.             cmp.b    #"q",d6
  1202.             beq.s    QuitGad
  1203.             cmp.b    #"a",d6
  1204.             beq.s    AboutGad
  1205.             cmp.b    #"s",d6
  1206.             beq.s    SaveGad
  1207.             cmp.b    #"h",d6
  1208.             beq.s    HideGad
  1209.  
  1210. NoGUI            RLoad
  1211.             rts
  1212.  
  1213. CloseGUI        RSave
  1214.             tst.w    GUIOpened(a4)
  1215.             beq.s    NotOpened
  1216.             move.l    IntBase(a4),a6
  1217.             move.l    MyWindow(a4),a0
  1218.             bsr    RemoveSignal
  1219.             ;move.l    MyWindow(a4),a0
  1220.             move.l    GadgetList(a4),a1
  1221.             moveq.l    #-1,d0
  1222.             CALL    RemoveGList
  1223.  
  1224.             move.l    MyWindow(a4),a0
  1225.             clr.l    d0
  1226.             move.w    wd_TopEdge(a0),d0
  1227.             move.l    d0,RemWindowY
  1228.             move.w    wd_LeftEdge(a0),d0
  1229.             move.l    d0,RemWindowX
  1230.             CALL    CloseWindow
  1231.             
  1232. FailWindow        move.l    GadgetList(a4),a0
  1233.             move.l    GadBase(a4),a6
  1234.             CALL    FreeGadgets
  1235.  
  1236.             move.l    MyVisual(a4),a0
  1237.             CALL    FreeVisualInfo
  1238.  
  1239.             move.l    IntBase(a4),a6
  1240.             sub.l    a0,a0
  1241.             move.l    PublicScreen(a4),a1
  1242.             CALL    UnlockPubScreen
  1243.  
  1244. NotOpened        clr.w    GUIOpened(a4)
  1245.  
  1246.             RLoad
  1247.             rts
  1248.  
  1249. EnterSignal        Push    d0-d1/a0          
  1250.             move.l  wd_UserPort(a0),a0
  1251.             move.b  MP_SIGBIT(a0),d0  
  1252.             move.l    SignalMask(a4),d1
  1253.             bset    d0,d1             
  1254.             move.l  d1,SignalMask(a4) 
  1255.             Pull    d0-d1/a0          
  1256.             rts                       
  1257.                                           
  1258. RemoveSignal        Push    d0-d1/a0          
  1259.             move.l  wd_UserPort(a0),a0
  1260.             move.b  MP_SIGBIT(a0),d0
  1261.             move.l    SignalMask(a4),d1
  1262.             bclr    d0,d1             
  1263.             move.l    d1,SignalMask(a4) 
  1264.             Pull    d0-d1/a0          
  1265.             rts
  1266.  
  1267. GetNexta0.1        tst.b    (a0)+
  1268. GetNexta0        move.b    (a0),d0
  1269.             cmp.b    #"=",d0
  1270.             beq.s    GetNexta0.1
  1271.             cmp.b    #" ",d0
  1272.             beq.s    GetNexta0.1
  1273.             or.w    #$20,d0
  1274.             rts
  1275.  
  1276. ;Screen in a0, X-Coord(rel) in d0, Y-Coord(rel) in d1
  1277. SetPointer        Push    a0-a2/d0-d1/a6
  1278.             lea    PointerPixEvent(a4),a2
  1279.             move.l    a0,iepp_Screen(a2)
  1280.             move.w    d0,iepp_PositionX(a2)
  1281.             move.w    d1,iepp_PositionY(a2)
  1282.  
  1283.             move.l    MyIORequest(a4),a1
  1284.             move.w    #IND_WRITEEVENT,io_Command(a1)
  1285.             lea    MyInputEvent(a4),a0
  1286.             move.l    #0,ie_NextEvent(a0)
  1287.             move.b    #IECLASS_NEWPOINTERPOS,ie_Class(a0)
  1288.             move.b    #IESUBCLASS_PIXEL,ie_SubClass(a0)
  1289.             move.w    #IECODE_NOBUTTON,ie_Code(a0)
  1290.             move.w    #IEQUALIFIER_RELATIVEMOUSE,ie_Qualifier(a0)
  1291.             move.l    a2,ie_EventAddress(a0)
  1292.             move.l    a0,io_Data(a1)
  1293.             move.l    #ie_SIZEOF,io_Length(a1)
  1294.             move.l    $04,a6
  1295.             CALL    DoIO
  1296.             Pull    a0-a2/a6/d0-d1
  1297.             rts
  1298.  
  1299. BuildPatterns        RSave
  1300.             tst.l    TempScreen(a4)
  1301.             beq.s    NoScreenPattern
  1302.             move.l    TempScreen(a4),a0
  1303.             bsr    GetNexta0
  1304.             lea    ScreenPatternMem(a4),a1
  1305.             bsr    CopyPattern
  1306.  
  1307.             lea    ScreenPatternMem(a4),a0
  1308.             lea    ScreenPatLen(a4),a2
  1309.             lea    ScreenPattern(a4),a3
  1310.             bsr    GetLen
  1311.             bpl    NoScreenPattern
  1312.             bsr    PatternError
  1313.  
  1314. NoScreenPattern        lea    ScreenPatternMem(a4),a0
  1315.             move.l    a0,TempScreen(a4)
  1316.             tst.l    TempWindow(a4)
  1317.             beq.s    NoWindowPattern
  1318.             move.l    TempWindow(a4),a0
  1319.             bsr    GetNexta0
  1320.             lea    WindowPatternMem(a4),a1
  1321.             bsr    CopyPattern
  1322.  
  1323.             lea    WindowPatternMem(a4),a0
  1324.             lea    WindowPatLen(a4),a2
  1325.             lea    WindowPattern(a4),a3
  1326.             bsr    GetLen
  1327.             bpl.s    NoWindowPattern
  1328.             bsr    PatternError
  1329.     
  1330. NoWindowPattern        lea    WindowPatternMem(a4),a0
  1331.             move.l    a0,TempWindow(a4)
  1332.             RLoad
  1333.             rts        
  1334.  
  1335. PatternError        lea    Text3(pc),a0
  1336.             bra    OpenRequester
  1337.  
  1338. ;a0:Source, a1:Dest
  1339. CopyPattern        move.w    #511,d0
  1340. CopyPattern2        move.b    (a0)+,(a1)+
  1341.             beq.s    EndCopy
  1342.             dbf    d0,CopyPattern2
  1343.             bsr    PatternError
  1344. EndCopy            rts
  1345.  
  1346.  
  1347. ;In: (a2): LEN - (a3): MEMORY - a0: Source-Pattern    :back: d0=pattern ok?
  1348. GetLen            move.l    a0,d6
  1349.             clr.l    d3
  1350. GetLen2            tst.b    (a0)+
  1351.             beq.s    EndOfString
  1352.             addq.l    #1,d3
  1353.             bra.s    GetLen2
  1354. EndOfString        lsl.w    #1,d3    ;StandardLen Of Pattern
  1355.             addq    #2,d3
  1356.             move.l    $04,a6
  1357.             tst.l    (a3)
  1358.             beq    AllocNew
  1359.             move.l    (a3),a1
  1360.             move.l    (a2),d0
  1361.             CALL    FreeMem
  1362.             clr.l    (a3)
  1363. AllocNew        move.l    d3,(a2)
  1364.             move.l    d3,d0
  1365.             move.l    #MEMF_CLEAR,d1
  1366.             CALL    AllocMem
  1367.             move.l    d0,d2
  1368.             beq    QuitPrg        ;No Memory? Good bye !
  1369.             move.l    d0,(a3)
  1370.             move.l    d6,d1
  1371.             move.l    DosBase(a4),a6
  1372.             CALL    ParsePatternNoCase
  1373.             rts
  1374.  
  1375.             
  1376. ;a0: Requester-Text
  1377. OpenRequester        Push    a0-a3
  1378.             lea    EasyReqStruct(a4),a1
  1379.             lea    PortName(pc),a2
  1380.             move.l    a2,es_Title(a1)
  1381.             move.l    a0,es_TextFormat(a1)
  1382.             lea    GadgetText(pc),a2
  1383.             move.l    a2,es_GadgetFormat(a1)
  1384.             move.l    IntBase(a4),a6
  1385.             sub.l    a0,a0
  1386.             ;a1: EasyReq
  1387.             sub.l    a2,a2
  1388.             sub.l    a3,a3
  1389.             CALL    EasyRequestArgs
  1390.             Pull    a0-a3
  1391.             rts
  1392.  
  1393. SaveConfig        RSave
  1394.             tst.l    WBMessage(a4)
  1395.             beq    SkipConfig
  1396.             move.l    WBMessage(a4),a3
  1397.             move.l    sm_ArgList(a3),d0
  1398.             beq    SkipConfig
  1399.             move.l    d0,a0
  1400.  
  1401.             move.l    IconBase(a4),a6
  1402.             move.l    wa_Name(a0),a0
  1403.             move.l    a0,d5
  1404.             CALL    GetDiskObject
  1405.             move.l    d0,DObject(a4)
  1406.             beq    SkipConfig
  1407.  
  1408.             move.l    d0,a0
  1409.             move.l    do_ToolTypes(a0),a5    ;Remember Old
  1410.             move.l    #1,TempDummy(a4)
  1411.  
  1412.             Push    a0/a6
  1413.             move.l    $04,a6
  1414.             move.l    #NumberOfTemps*10+2*512+2*8,d0    ;Memory for tool arrays
  1415.             move.l    #MEMF_CLEAR,d1
  1416.             CALL    AllocMem
  1417.             move.l    d0,a3
  1418.             beq    MemErrTool
  1419.             move.l    DObject(a4),a0
  1420.             move.l    d0,do_ToolTypes(a0)
  1421.  
  1422.             move.l    d0,a1
  1423.             add.l    #(NumberOfTemps+1)*4,a1    ;Maximum Number of Pointers
  1424.  
  1425.             clr.l    d7
  1426.             lea    WBTemplate(pc),a2
  1427. LoopAllTemps        sub.l    a0,a0
  1428.             move.w    TemplateA4(a2),a0
  1429.             add.l    a4,a0
  1430.             move.l    (a0),d6
  1431.             beq.s    IsDefault
  1432.             move.l    a1,(a3,d7)
  1433.             move.l    TemplateText(a2),a0
  1434.             bsr    CopyPattern
  1435.             move.w    TemplateType(a2),d1
  1436.             beq    ThatsAllTemp
  1437.             move.b    #"=",-1(a1)
  1438.             
  1439.             cmp.w    #T_CYCLE,d1
  1440.             bne.s    ThatsString
  1441.             move.l    TemplateSpecial(a2),a0
  1442.             lsl.l    #2,d6
  1443.             move.l    (a0,d6.w),a0
  1444.             bsr    CopyPattern
  1445.             bra.s    ThatsAllTemp
  1446.  
  1447. ThatsString        cmp.w    #T_STRING,d1
  1448.             bne.s    ThatsInteger
  1449.             move.l    d6,a0
  1450.             bsr    CopyPattern
  1451.             bra.s    ThatsAllTemp
  1452.  
  1453. ThatsInteger        move.l    d6,d0
  1454.             bsr    PrintInteger
  1455.  
  1456. ThatsAllTemp        addq.l    #4,d7
  1457.             move.l    a1,d0
  1458.             and.l    #$ffffffc,d0
  1459.             move.l    d0,a1
  1460.             lea    4(a1),a1    ;Align on Longwords
  1461. IsDefault        add.l    #TemplateSize,a2
  1462.             tst.l    TemplateText(a2)
  1463.             bne    LoopAllTemps
  1464.  
  1465.             move.l    d5,a0
  1466.             move.l    DObject(a4),a1
  1467.             move.l    IconBase(a4),a6
  1468.             CALL    PutDiskObject
  1469.             bne.s    Done
  1470.             lea    Text4(pc),a0
  1471.             bsr    OpenRequester
  1472.  
  1473. Done            move.l    $04,a6
  1474.             move.l    #NumberOfTemps*10+2*512+2*8,d0
  1475.             move.l    a3,a1
  1476.             CALL    FreeMem
  1477. MemErrTool        Pull    a0/a6
  1478.  
  1479.             move.l    a5,do_ToolTypes(a0)
  1480.             move.l    DObject(a4),a0
  1481.             CALL    FreeDiskObject
  1482.                 
  1483.             bra.s    DoneConfig
  1484.  
  1485. SkipConfig        lea    Text4(pc),a0
  1486.             bsr    OpenRequester
  1487. DoneConfig        RLoad
  1488.             rts
  1489.  
  1490.  
  1491. ;Where in hell has this damned OS a atoi and itoa function???
  1492.  
  1493. ;Quick implementation of word-only functions:
  1494.  
  1495. ;a0:String    Back: d0: Integer
  1496. GetInteger        Push    d1-d2/a0
  1497.             moveq.l    #0,d0
  1498.             moveq.l    #0,d1
  1499.             moveq.l    #1,d2
  1500.             cmp.b    #"-",(a0)
  1501.             bne.s    GetDezNr
  1502.             tst.b    (a0)+
  1503.             moveq.l    #-1,d2
  1504. GetDezNr        move.b    (a0)+,d1
  1505.             cmp.b    #"0",d1
  1506.             bcs    StringOver
  1507.             cmp.b    #"9"+1,d1
  1508.             bcc    StringOver
  1509.             sub.w    #$30,d1
  1510.             mulu    #$0a,d0
  1511.             add.l    d1,d0
  1512.             bra.s    GetDezNr
  1513. StringOver        muls    d2,d0
  1514.             Pull    d1-d2/a0
  1515.             rts    
  1516.  
  1517. ;d0: Integer        a1:String
  1518. PrintInteger        tst.l    d0
  1519.             bpl.s    PrDez0
  1520.             move.b    #"-",(a1)+
  1521.             neg.l    d0
  1522. PrDez0            move.w    #-1,-(sp)
  1523. PrDez            divu    #$0a,d0
  1524.             swap    d0
  1525.             move.w    d0,-(sp)
  1526.             clr.w    d0
  1527.             swap    d0
  1528.             bne.s    PrDez
  1529. PrDez1            move.w    (sp)+,d0
  1530.             bmi.s    CloseUp
  1531.             add.w    #"0",d0
  1532.             move.b    d0,(a1)+
  1533.             bra.s    PrDez1
  1534. CloseUp            clr.b    (a1)+
  1535.             rts
  1536.  
  1537. InstallHotKey        Push    a0-a1/a6
  1538. InstallHotKey2        lea    DefaultDescr(pc),a0
  1539.             lea    Description(a4),a1
  1540.             tst.l    TempCXPOPKEY(a4)
  1541.             beq.s    NoPOPKEY
  1542.             move.l    TempCXPOPKEY(a4),a0
  1543.             bsr    GetNexta0
  1544. NoPOPKEY        move.l    a1,TempCXPOPKEY(a4)
  1545.             bsr    CopyKey
  1546.             bmi.s    HotKeyError
  1547.  
  1548.             bsr    RemovePopKey
  1549.  
  1550.             lea    Description(a4),a0
  1551.             move.l    MyPort(a4),a1
  1552.             move.l    #1,d0    ;ID... I only got one Key to manage
  1553.             bsr    HotKey
  1554.             bmi    HotKeyError
  1555.             move.l    a0,Filter(a4)
  1556.             CALL    CxObjError
  1557.             bne.s    DeleteAndErr
  1558.             move.l    Filter(a4),a1
  1559.             move.l    Broker(a4),a0
  1560.             CALL    AttachCxObj
  1561.             Pull    a0-a1/a6
  1562.             rts
  1563.  
  1564. DeleteAndErr        bsr    DeletePopKey
  1565. HotKeyError        lea    HotKeyErrorT(pc),a0
  1566.             bsr    OpenRequester
  1567.             clr.l    TempCXPOPKEY(a4)
  1568.             bra.s    InstallHotKey2
  1569.  
  1570. CopyKey            move.w    #63,d0
  1571. CopyString        move.b    (a0)+,(a1)+
  1572.             beq.s    EndString
  1573.             dbf    d0,CopyString
  1574.             moveq.l    #-1,d0
  1575. EndString        rts
  1576.  
  1577. RemovePopKey        move.l    CommBase(a4),a6
  1578.             tst.l    Filter(a4)
  1579.             beq.s    NoFilter
  1580.             move.l    Filter(a4),a0
  1581.             CALL    RemoveCxObj
  1582. DeletePopKey        move.l    Filter(a4),a0
  1583.             CALL    DeleteCxObjAll
  1584.             clr.l    Filter(a4)
  1585. NoFilter        rts                
  1586.  
  1587.  
  1588. ;Implementation of the cx.lib function
  1589. ;HotKey(char *Description,MsgPort *CxPort,long Event)
  1590.  
  1591. ;a0=Description, a1=CxPort, d0=Event    ;Back: d0:Error, a0:Filter
  1592. HotKey            Push    d1-d7/a1-a2/a6
  1593.             move.l    a1,a2        ;Rem Port
  1594.             move.l    d0,d6        ;Rem Event
  1595.             move.l    CommBase(a4),a6
  1596.             move.l    #CX_FILTER,d0
  1597.             ;Description is in a0
  1598.             sub.l    a1,a1
  1599.             CALL    CreateCxObj
  1600.             move.l    d0,d7        ;Remember Filter
  1601.             beq.s    HKErr2
  1602.             move.l    #CX_SEND,d0
  1603.             move.l    a2,a0        ;Given Port
  1604.             move.l    d6,a1        ;Event
  1605.             CALL    CreateCxObj
  1606.             move.l    d0,d6        ;Remember Sender
  1607.             beq.s    HKErr
  1608.             move.l    d7,a0        ;Filter
  1609.             move.l    d6,a1        ;Sender
  1610.             CALL    AttachCxObj
  1611.             move.l    #CX_TRANSLATE,d0
  1612.             sub.l    a0,a0
  1613.             move.l    a0,a1
  1614.             CALL    CreateCxObj
  1615.             move.l    d0,a1
  1616.             tst.l    d0
  1617.             beq.s    HKErr
  1618.             move.l    d6,a0        ;Sender
  1619.             ;Translate is in a1
  1620.             CALL    AttachCxObj
  1621.             move.l    d7,a0        ;Return Filter in a0
  1622.             moveq.l    #0,d0
  1623.             bra.s    HKOut
  1624. HKErr            move.l    Filter(a4),a0
  1625.             CALL    DeleteCxObjAll
  1626. HKErr2            
  1627.             lea    GadgetText(pc),a0
  1628.             bsr    OpenRequester
  1629.             moveq.l    #-1,d0
  1630. HKOut            Pull    d1-d7/a1-a2/a6
  1631.             rts
  1632.  
  1633. StringTagList        dc.l    GTST_String
  1634.             dc.l    0
  1635.             dc.l    GTST_MaxChars
  1636.             dc.l    511
  1637.             dc.l    TAG_DONE
  1638.  
  1639. CycleTagList        dc.l    GTCY_Active
  1640.             dc.l    0
  1641.             dc.l    GTCY_Labels
  1642.             dc.l    CycleList
  1643.             dc.l    TAG_DONE
  1644.  
  1645. CycleTagList2        dc.l    GTCY_Active
  1646.             dc.l    0
  1647.             dc.l    GTCY_Labels
  1648.             dc.l    CycleList2
  1649.             dc.l    TAG_DONE
  1650.  
  1651. GadgetTagList        dc.l    GTCB_Checked
  1652.             dc.l    0
  1653.             dc.l    TAG_DONE
  1654.  
  1655. TagList            dc.l    GA_Disabled
  1656.             dc.l    0
  1657.             dc.l    GT_Underscore
  1658.             dc.l    '_'
  1659. TagListDone        dc.l    TAG_DONE
  1660.  
  1661. WindowTagList        dc.l    WA_InnerWidth
  1662. StoreInnerWidth            dc.l    0
  1663.             dc.l    WA_InnerHeight
  1664. StoreInnerHeight        dc.l    0
  1665.             dc.l    WA_IDCMP
  1666.                 dc.l    BUTTONIDCMP!CLOSEWINDOW!IDCMP_VANILLAKEY
  1667.             dc.l    WA_Flags
  1668.                 dc.l    WINDOWCLOSE!WINDOWDRAG!WINDOWDEPTH!ACTIVATE    
  1669.             dc.l    WA_PubScreen
  1670. StorePublicScreen        dc.l    0
  1671.             dc.l    WA_Title
  1672.                 dc.l    Texth
  1673.             dc.l    WA_AutoAdjust
  1674.                 dc.l    1
  1675.             dc.l    WA_Left
  1676. RemWindowX            dc.l    -1
  1677.             dc.l    WA_Top
  1678. RemWindowY            dc.l    -1
  1679.             dc.l    TAG_DONE
  1680. RememberA4        dc.l    0
  1681. RememberStack        dc.l    0
  1682.  
  1683.             rsreset
  1684.  
  1685. DisplayInfer        rs.b    dim_SIZEOF
  1686. ScreenPatLen        rs.l    1
  1687. ScreenPattern        rs.l    1
  1688. WindowPatLen        rs.l    1
  1689. WindowPattern        rs.l    1
  1690. GadgetList        rs.l    1
  1691. What            rs.w    1
  1692. DisableHW        rs.w    1
  1693. GUIOpened        rs.w    1
  1694. QuitMe            rs.w    1
  1695. RemFontSize        rs.w    1
  1696. GadgetInside        rs.w    11
  1697. MyPort            rs.l    1
  1698. MyVisual        rs.l    1
  1699. Broker            rs.l    1
  1700. ScreenMem        rs.b    ScreenMemSize
  1701. IntBase            rs.l    1
  1702. RemLen            rs.w    1
  1703. RemHeight        rs.w    1
  1704. RemTop            rs.w    1
  1705. RemLeft            rs.w    1
  1706.  
  1707. GadBase            rs.l    1
  1708. DosBase            rs.l    1
  1709. CommBase        rs.l    1
  1710. IconBase        rs.l    1
  1711. DObject            rs.l    1
  1712. Active            rs.l    1
  1713. FirstSc            rs.l    1
  1714. GraphicsBase        rs.l    1
  1715. PublicScreen        rs.l    1
  1716. PublicRastport        rs.l    1
  1717. Gadget0            rs.l    1
  1718. Filter            rs.l    1
  1719. VisualX            rs.w    1
  1720. VisualY            rs.w    1
  1721. TemplateArray        rs.l    0    ;Do not change order!
  1722. TempMove        rs.l    1
  1723. TempSFront        rs.l    1
  1724. TempWFront        rs.l    1
  1725. TempPDef        rs.l    1
  1726. TempAlways        rs.l    1
  1727. TempRemWin        rs.l    1
  1728. TempMoveMouse        rs.l    1
  1729. TempCXPOPUP        rs.l    1
  1730. TempCXPRI        rs.l    1
  1731. TempCXPOPKEY        rs.l    1
  1732. TempHADJ        rs.l    1
  1733. TempVADJ        rs.l    1
  1734. TempScreen        rs.l    1
  1735. TempWindow        rs.l    1
  1736. TempDummy        rs.l    1
  1737. TempZero        rs.l    1
  1738. TempSave        rs.l    1
  1739.  
  1740. OwnTask            rs.l    1
  1741. Signal            rs.l    1
  1742. Args            rs.l    1
  1743. WBMessage        rs.l    1
  1744. SignalMask        rs.l    1
  1745. MyWindow        rs.l    1
  1746. LastGadget        rs.l    1
  1747. MyIORequest        rs.l    1
  1748. MouseMsgPort        rs.l    1
  1749. MyNewGadget        rs.b    gng_SIZEOF
  1750. MyInterrupt        rs.b    IS_SIZE
  1751. MyInputEvent        rs.b    ie_SIZEOF
  1752. PointerPixEvent        rs.b    IEPointerPixel_SIZEOF
  1753. EasyReqStruct        rs.b    es_SIZEOF
  1754. Description        rs.b    64
  1755. ScreenPatternMem    rs.b    512    ;sufficient I think
  1756. WindowPatternMem    rs.b    512
  1757. AllocLength        rs.w    1
  1758.  
  1759. intuition        dc.b    "intuition.library",0
  1760. DosName            dc.b    "dos.library",0
  1761. InputName        dc.b    "input.device",0
  1762. GraphicsName        dc.b    "graphics.library",0
  1763. IconName        dc.b    "icon.library",0
  1764. GadName            dc.b    "gadtools.library",0
  1765. CommName        dc.b    "commodities.library",0
  1766.             even
  1767.  
  1768. MyNewBroker        dc.b    NB_VERSION    ;Version
  1769.             dc.b    0        ;Reserve1
  1770.             dc.l    HandlerName    ;Name
  1771.             dc.l    PortName    ;Title
  1772.             dc.l    DescText    ;Description
  1773.             dc.w    NBU_NOTIFY!NBU_UNIQUE        ;Unique
  1774.             dc.w    COF_SHOW_HIDE    ;Flags
  1775. MyPri            dc.b    0        ;Pri
  1776.             dc.b    0        ;Reserve2
  1777. BrokerPort        dc.l    0        ;Port
  1778.             dc.w    0        ;ReservedChannel
  1779.  
  1780. CycleList    dc.l    GUI_Choose1.1,GUI_Choose1.2,GUI_Choose1.3,GUI_Choose1.4,0
  1781. CycleList2    dc.l    GUI_Choose2.1,GUI_Choose2.2,GUI_Choose2.3,GUI_Choose2.4,0
  1782.  
  1783.         rsreset
  1784. TemplateText    rs.l    1
  1785. TemplateSpecial    rs.l    1
  1786. TemplateA4    rs.w    1
  1787. TemplateType    rs.w    1
  1788. TemplateSize    rs.w    0
  1789.  
  1790. T_CHECK        =    0
  1791. T_CYCLE        =    1
  1792. T_STRING    =    2
  1793. T_INTEGER    =    3
  1794.  
  1795. NumberOfTemps    =    13
  1796.  
  1797. WBTemplate    dc.l    TextDNW,0
  1798.         dc.w    TempDummy,T_CHECK
  1799.  
  1800.         dc.l    TextMove,0
  1801.         dc.w    TempMove,T_CHECK
  1802.  
  1803.         dc.l    TextSFront,0
  1804.         dc.w    TempSFront,T_CHECK
  1805.  
  1806.         dc.l    TextWFront,0
  1807.         dc.w    TempWFront,T_CHECK
  1808.  
  1809.         dc.l    TextPDef,0
  1810.         dc.w    TempPDef,T_CHECK
  1811.  
  1812.         dc.l    TextAlways,0
  1813.         dc.w    TempAlways,T_CHECK
  1814.  
  1815.         dc.l    TextRemWin,0
  1816.         dc.w    TempRemWin,T_CHECK
  1817.  
  1818.         dc.l    TextMoveMouse,0
  1819.         dc.w    TempMoveMouse,T_CHECK
  1820.  
  1821.         dc.l    TextCXPOPUP,0
  1822.         dc.w    TempCXPOPUP,T_CHECK
  1823.  
  1824.         dc.l    TextScreen,0
  1825.         dc.w    TempScreen,T_STRING
  1826.  
  1827.         dc.l    TextWindow,0
  1828.         dc.w    TempWindow,T_STRING
  1829.  
  1830.         dc.l    TextCXPOPKEY,0
  1831.         dc.w    TempCXPOPKEY,T_STRING
  1832.  
  1833.         dc.l    TextCXPRI,0
  1834.         dc.w    TempCXPRI,T_INTEGER
  1835.  
  1836.         dc.l    TextHADJ,CycleList
  1837.         dc.w    TempHADJ,T_CYCLE
  1838.  
  1839.         dc.l    TextVADJ,CycleList2
  1840.         dc.w    TempVADJ,T_CYCLE
  1841.  
  1842.         dc.l    0
  1843.  
  1844.  
  1845. TextDNW        dc.b    "DONOTWAIT",0
  1846. TextMove    dc.b    "MOVE",0
  1847. TextSFront    dc.b    "SFRONT",0
  1848. TextWFront    dc.b    "WFRONT",0
  1849. TextPDef    dc.b    "DEFPUB",0
  1850. TextAlways    dc.b    "ALWAYS",0
  1851. TextCXPOPUP    dc.b    "CX_POPUP",0
  1852. TextCXPRI    dc.b    "CX_PRIORITY",0
  1853. TextCXPOPKEY    dc.b    "CX_POPKEY",0
  1854. TextRemWin    dc.b    "REMWIN",0
  1855. TextMoveMouse    dc.b    "MOVEMOUSE",0
  1856. TextHADJ    dc.b    "HADJ",0
  1857. TextVADJ    dc.b    "VADJ",0
  1858. TextScreen    dc.b    "SCREEN",0
  1859. TextWindow    dc.b    "WINDOW",0
  1860. Template    dc.b    "MOVE/S,SFRONT/S,WFRONT/S,DEFPUB/S,ALWAYS/S,REMWIN/S,MOVEMOUSE/S,CX_POPUP/S,CX_PRIORITY/K,CX_POPKEY/K,HADJ/K,VADJ/K,SCREEN/K,WINDOW/K",0
  1861. PortName    dc.b    "Huntwindows 2.6",0
  1862. HandlerName    dc.b    "Huntwindows",0
  1863. GadgetText    dc.b    "Ok",0
  1864. DefaultDescr    dc.b    "control alt h",0
  1865. AboutText    dc.b    "© by Jörg Bublath 1992-1993",$0a,"EMAIL:",$0a,"bublath@forwiss.uni-passau.de",0
  1866. HotKeyErrorT    dc.b    "Wrong hotkey description!",$0a,0
  1867. Text1        dc.b    "Error in arguments or libraries!",$0a,0
  1868. Text2        dc.b    "I need V36+ !",$0a,0
  1869. Text3        dc.b    "Error in given patterns!",$0a,0
  1870. Text4        dc.b    "Cannot Save!",$0a,0
  1871.         dc.b    "$VER: "    ;for version information
  1872. Texth        dc.b    "Huntwindows 2.6 (5.4.93) by Jörg Bublath",0
  1873. DescText    dc.b    "Moves screen to show windows",0
  1874. GUI_Text1    dc.b    "Move Screen",0
  1875. GUI_Text2    dc.b    "ScreenToFront",0
  1876. GUI_Text3    dc.b    "WindowToFront",0
  1877. GUI_Text5    dc.b    "Set Default PubScreen",0
  1878. GUI_Text6    dc.b    "Always",0
  1879. GUI_Text7    dc.b    "Remember Window",0
  1880. GUI_Text7_1    dc.b    "Move Mouse",0
  1881. GUI_Text7_2    dc.b    "GUI Popup",0
  1882. GUI_Text8    dc.b    "Horizontal Adjustment",0
  1883. GUI_Text9    dc.b    "Vertical Adjustment",0
  1884. GUI_Text10    dc.b    "_Hide",0
  1885. GUI_Text11    dc.b    "_Quit",0
  1886. GUI_Text12    dc.b    "Screen Pattern",0
  1887. GUI_Text13    dc.b    "Window Pattern",0
  1888. GUI_Text14    dc.b    "_Save",0
  1889. GUI_Text15    dc.b    "_About",0
  1890. GUI_Text16    dc.b    "Popup Hotkey",0
  1891. GUI_TextEnd    ;
  1892. GUI_Choose1.1    dc.b    "left",0
  1893. GUI_Choose1.2    dc.b    "right",0
  1894. GUI_Choose1.3    dc.b    "center",0
  1895. GUI_Choose1.4    dc.b    "off",0
  1896. GUI_Choose2.1    dc.b    "top",0
  1897. GUI_Choose2.2    dc.b    "bottom",0
  1898. GUI_Choose2.3    dc.b    "center",0
  1899. GUI_Choose2.4    dc.b    "off",0
  1900.         even
  1901.